<template>
	<view class="news-information" :key="refreshKey">
		<view class="new" v-for="record in records" @click="detailPage(record)">
			<view class="new-l" v-if="record.mainPic">
				<image style="width: 168rpx; height: 168rpx;border-radius: 16rpx;" mode="aspectFit"
					:src="record.mainPic"></image>
				</view>
			<view class="new-r">
				<view class="new-title">{{ record.title }}</view>
				<view class="new-summary">
					<text class="uv-line-2">{{record.publishTime}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				records: [],
				refreshKey:0
			}
		},
		onLoad(option) {
			this.findAllNoticeAbstract();
		},
		onShow(){
			this.refreshKey += 1;
		},
		methods: {

			detailPage(record) {
				uni.navigateTo({
					url: '../noticeDetail/noticeDetail?id=' + record.id
				});
			},

			findAllNoticeAbstract() {
				uni.$uv.http.get('/notice/findAllNoticeAbstract').then(res => {
					this.records = res.data;
				});
			},

		}
	}
</script>

<style scoped>
page {
	height: auto !important;
	background: url('/static/img/my_bg.png') no-repeat;
	background-size: 100% 100%;
	background-color: #FFFFFF;
}
	.news-information{
		height: 100%; 
		overflow-y: auto;
	}
	.new-title {
		font-size: 30rpx;
		padding-bottom: 30rpx;
		font-weight: bold;
	}

	.new-l {}

	.new-r {
		flex: 1;
		padding-right: 60rpx;
	}

	.new-summary {
		font-size: 24rpx;
		color: #888;
	}

	.new {
		display: flex;
		align-items: center;
		background-color: #FFF;
		margin: 0 40rpx;
		padding: 16rpx;
		border-radius: 20rpx;
		margin-bottom: 28rpx;
	}
	.new:first-child{
		margin-top: 40rpx;
	}
	.new:last-child{
		margin-bottom: 40rpx;
	}
	
	.new-title {
		font-weight: 600;
		font-size: 28rpx;
		padding-bottom: 30rpx;
		letter-spacing: 1px;
		color: #000;
	}
	
</style>